﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace GestorDeFlotasDesktop
{
    public partial class Menu : MasterPage 
    {

        Array funcion=Array.CreateInstance(typeof(Int32),12);
 
        Form ventanPadre;
        public Menu(Form ventanaParam,ArrayList roles)
        {
          roles.CopyTo(funcion);
          InitializeComponent( );
          ocultarMenu(ref ventanPadre, ventanaParam);
          
        }

        private void Menu_Load(object sender, EventArgs e)
        {
            menuStrip1.Show(); 
            
            
            
            int cant_funcionalidades = funcion.Length;
            

            if (Convert.ToInt32(funcion.GetValue(0)) == 0) {

                aBMClienteToolStripMenuItem.Visible = false;
            }
            if (Convert.ToInt32(funcion.GetValue(1)) == 0)
            {

                aBMRolToolStripMenuItem.Visible = false;
            }
            if (Convert.ToInt32(funcion.GetValue(2)) == 0)
            {
                aBMUsuarioToolStripMenuItem.Visible = false;

            }
            if (Convert.ToInt32(funcion.GetValue(3)) == 0)
            {

                aBMAutoToolStripMenuItem.Visible = false;
            }
            if (Convert.ToInt32(funcion.GetValue(4)) == 0)
            {
                aBMRelojToolStripMenuItem.Visible = false;

            }
            if (Convert.ToInt32(funcion.GetValue(5)) == 0)
            {
                aBMChoferToolStripMenuItem.Visible = false;

            }
            if (Convert.ToInt32(funcion.GetValue(6)) == 0)
            {
                aBMTurnoToolStripMenuItem.Visible = false;

            }
            if (Convert.ToInt32(funcion.GetValue(7)) == 0)
            {
             asignaciónChoferTaxiToolStripMenuItem.Visible = false ;
                
            }
            if (Convert.ToInt32(funcion.GetValue(8)) == 0)
            {
                registrarViajesToolStripMenuItem.Visible = false;

            }
            if (Convert.ToInt32(funcion.GetValue(9)) == 0)
            {

                rendirViajesToolStripMenuItem.Visible = false;
            }
            if (Convert.ToInt32(funcion.GetValue(10)) == 0)
            {
                facturacionToolStripMenuItem1.Visible = false;

            }
            if (Convert.ToInt32(funcion.GetValue(11)) == 0)
            {
                estadisticaToolStripMenuItem.Visible = false;

            }


           
        }

        private void aBMAutoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new AbmAuto.AbmAuto(this));
        }

        private void aBMChoferToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new AbmChofer.AbmChofer(this) );
        }

        private void aBMRelojToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new AbmReloj.AbmReloj(this));
        }

        private void aBMRolToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new AbmRol.Form1(this));
        }

        private void aBMTurnoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new AbmTarifa.AbmTarifa(this));
        }

        private void aBMUsuarioToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new AbmUsuario.AbmUsuario(this));
        }

        private void rendirViajesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new RendirViajes.RendierViajes(this));
        }

        private void registrarViajesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new RegistrarViaje.RegistrarViajes(this));
        }

        private void aBMClienteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new Cliente.Cliente(this));
        }

      

        private void estadisticaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new Estadisticas.Form1(this));
        }

    

       

        private void salirDeLaAplicacionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult ventana;
            ventana = MessageBox.Show("Esta seguro que desea salir de la aplicacion ");
            if (ventana.Equals(DialogResult.OK)) 
            { this.Close();
            ventanPadre.Close();
            }
        }

        private void Menu_FormClosing(object sender, FormClosingEventArgs e)
        {
            ventanPadre.Close();
        }

        private void facturacionViajesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new Facturar.Facturar(this));
        }
        private void facturacionToolStripMenuItem1_Click(object sender, EventArgs e) 
        { 
            showForm(new Facturar.Facturar(this)); 
        }

        private void asignaciónChoferTaxiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            showForm(new Chofer_Auto.AsignacionChoferAuto(this));
        }

        private void asignacionesToolStripMenuItem_Click(object sender, EventArgs e)
        {

        } 
       

    

      
      
    }
}
